import json

import requests


def get_dogeScan_data(tx_hash):
    # 交易网站的网址
    url=f'https://api.blockchair.com/dogecoin/dashboards/transaction/{tx_hash}'

    headers = {
            'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0'
        }
    response = requests.get(url=url,headers=headers)

    if response.status_code == 200:
        print("DOGE链数据爬取完成！")
        # json_data = json.dumps(response.json(), indent=4)
        # with open('../data/dogedata.json', 'w', encoding='utf-8') as f:
        #     f.write(json_data)
        return response.json()
    else:

        print(f"Error: {response.status_code}, {response.text}")


# get_dogeScan_data("43F2ED58628057ADD274D3A60319AB1B16FFEAE948882EFBA78D332A65DBB1BD")

